<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../../resources/js-test.js"></script>
</head>
<body onload="test()">
<p>This test checks that the context menu is shown on long tap gesture.</p>
<div id="text" draggable='true'>Testing</div>
<div id="dragresult">FAIL</div>
<div id="result">FAIL</div>
<script>
function test()
{
    if (window.testRunner)
        testRunner.dumpAsText();

    if (window.internals)
        internals.settings.setTouchDragDropEnabled(true);

    document.ondragstart = function() { document.getElementById("dragresult").innerHTML = "PASS"; }
    document.oncontextmenu = function() { document.getElementById("result").innerHTML = "PASS"; }

    var text = document.getElementById("text");

    var x = text.offsetParent.offsetLeft + text.offsetLeft + 4;
    var y = text.offsetParent.offsetTop + text.offsetTop + text.offsetHeight / 2;

    if (!window.eventSender)
        return;
    if (eventSender.gestureLongTap) {
        // Send long press first on the draggable div to start a drag. This
        // will enable context menu on the subsequent long tap.
        eventSender.gestureLongPress(x, y);
        eventSender.gestureLongTap(x, y);
    } else {
        debug("gestureLongTap not implemented by this platform");
        return;
    }
}
</script>
</body>
</html>
